package org.javaboy.vhr.test;


import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.http.MediaType;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Set;

import static org.apache.commons.codec.binary.Hex.DEFAULT_CHARSET;

/**
 * @Author Willie Chen
 * @Description
 * @Date 2020/9/10
 * @Param
 **/


public class demo {

    @Test
    public void tests() {
        int limit = 20;
        String str="aabbccddeeffggghhhiiijjjkkkllllmmmmmooooppppqqqqrrrsssttttuuuuvvvvwwwwwssssyyyyzzzz";
        Set resultSet = new HashSet();

        while(StringUtils.isNotBlank(str)){
        String tem = substring(str, limit);
        Set set = new HashSet(Lists.newArrayList(tem.split("")));
        resultSet.addAll(set);
        str = last(str, limit);
      }
        System.out.println(resultSet);

    }

    private String substring(String str, int limit) {

        if (str.length() > limit) {
            return str.substring(0, limit);

        }
        return str;
    }

        private String last(String str,int limit){
            if (str.length() > limit) {
                return str.substring(limit,str.length());
            }
            return "";

        }





        @Test
        public void getForm() throws UnsupportedEncodingException {
            System.out.println(new String("你好".getBytes("gbk"),"ISO8859-1"));
        }




/*        private  String cut(String str,int limit){
            return "";
        }*/

    }


